    
    import { reqGetSearchInfo } from "@/api"
    //state：仓库存储数据的地方
    const state = {
        searchList:{}
    }
        //mutation:修改state的唯一手段
    const mutations = {
        GETSEARCHLIST(state,searchList){
            state.searchList = searchList
        }
    }
        //action:书写业务逻辑，处理异步
    const actions = {
         async getSearchList({commit},params){
            //  当前这个函数在调用获取服务器数据的时候，至少传一个参数（空对象）
            // params是用户派发action的第二个参数传过来的
            let re = await reqGetSearchInfo(params)
            if(re.code == 200){
                commit('GETSEARCHLIST',re.data)
            }
        }
    }
        //getters 简化仓库数据，组件获取仓库数据更加方便
    const getters = {
        //state:当前仓库的state
        goodsList(state){
            return state.searchList.goodsList || []
        },
        trademarkList(state){
            return state.searchList.trademarkList || []
        },
        attrsList(state){
            return state.searchList.attrsList || []
        },
        total(state){
            return state.searchList.total
        }
     }
    export default {
        state,
        mutations,
        actions,
        getters
    }